package com.song.demo.webmvc.aop;

import java.lang.reflect.Method;

/**
 * 后置通知实现类
 */
public class GPAfterReturn extends GPAbstractAspectJAdvice implements GPAdvice,GPMethodInterceptor {

    private GPJoinPoint joinPoint;

    public GPAfterReturn(Method method, Object newInstance) {
        super(method,newInstance);
    }

    @Override
    public Object invoke(GPMethodInvocation mi) throws Throwable {
        Object retValue = mi.proceed();
        this.joinPoint = mi;
        after(mi.getMethod(),mi.getArguments(),mi.getThis());
        return retValue;
    }

    public void after(Method method,Object[] args,Object target) throws Throwable {
        invokeAdviceMethod(this.joinPoint,null,null);
    }

}
